<!--  -->
<template>
  <el-dialog
    v-model="showDelGoods"
    title="提示"
    width="30%"
    top="30vh"
    :before-close="() => cancel()"
  >
    <span>
      <el-icon color="red" class="no-inherit">
        <Warning />
      </el-icon>
      是否要进行删除操作？</span
    >
    <template #footer>
      <span class="dialog-footer">
        <el-button @click="cancel()">取消</el-button>
        <el-button type="primary" @click="updateProduct">确认</el-button>
      </span>
    </template>
  </el-dialog>
</template>

<script lang="ts" setup>
import { reactive, toRefs, ref } from "vue";
import * as http from "../../../request/http";
import { ElMessage } from "element-plus";
// toast提示框
const openToast = () => {
  ElMessage({
    message: "删除成功",
    type: "success",
  });
};

// 父传子 显示隐藏组件
let props = defineProps<{
  showDelGoods: boolean;
}>();

// 子传父点击取消
let emit = defineEmits<{
  (event: "hidden", flag?: string): void;
}>();

function cancel(flag?: string) {
  emit("hidden", flag);
}

// 点击确定
async function updateProduct() {
  cancel("reloadDel");
  openToast();
}
</script>
<style lang="less" scoped></style>
